﻿using System;
using Besture.Common.Helper;
using Besture.UI.ClassHelper;

using DevExpress.Web.ASPxGridView;
using Besture.Common;
using Besture.Bll;

namespace Besture.UI.Admin.Sys
{
    public partial class LogList : BasePage
    {
        /// <summary>
        /// 初始化页面
        /// </summary>
        protected override void InitialLoad()
        {
            BindData();
            AspxGridViewHelper.InitAspxGridView(grid);
        }

        /// <summary>
        /// 回发
        /// </summary>
        protected override void PostBackLoad()
        {
            BindData();
        }

        /// <summary>
        /// 绑定数据
        /// </summary>
        public void BindData()
        {
            LogDac logDac = new LogDac();
            grid.DataSource = logDac.GetDataTable();
            grid.DataBind();
        }

        /// <summary>
        /// AspxGridView回发事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void grid_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e)
        {
            if (e.Parameters == "Refresh")
                grid.DataBind();
        }


        /// <summary>
        /// 删除90天前日志数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void BtnDelClick(object sender, EventArgs e)
        {
            LogDac logDac = new LogDac();
            logDac.DeleteLog(90);
            FunHelper.Alert("删除成功", "LogList.aspx");
            BindData();
        }

    }
}